var a = require("../../utils/api.js"), e = getApp();

Page({
    data: {
        status: 0
    },
    onLoad: function(t) {
        var o = t.id, n = t.mid, i = this;
        if (wx.setNavigationBarColor({
            frontColor: wx.getStorageSync("basic").topcolor,
            backgroundColor: wx.getStorageSync("basic").topbg
        }), i.setData({
            id: o
        }), "" != n && void 0 != n && (e.globalData.share_mid = n, e.globalData.share_url = "/pages/order/showOrderDetail?id=" + o), 
        console.log(wx.getStorageSync("head_info")), "" != wx.getStorageSync("head_info") && void 0 != wx.getStorageSync("head_info") || a.getTeamOpenid({
            openid: e.globalData.openid
        }).then(function(a) {
            "" == a.data.user.m_head_openid && wx.reLaunch({
                url: "/pages/group/groupList"
            });
        }), wx.getStorageSync("head_info").m_id != e.globalData.share_mid && "" != e.globalData.share_mid && void 0 != e.globalData.share_mid) {
            var d = {
                openid: wx.getStorageSync("openid"),
                head_mid: e.globalData.share_mid
            };
            a.selectShareHead(d).then(function(a) {
                if (console.log(a), 0 == a.errno) {
                    wx.setStorageSync({
                        key: "head_info",
                        data: a.data
                    });
                    wx.getStorageSync("head_info");
                    i.setData({
                        items: a.data
                    });
                }
            });
        }
        a.getorderDetails({
            id: o
        }).then(function(e) {
            console.log(e.data);
            var t = e.data.item[0].oss_address_phone, o = t.substr(0, 3) + "****" + t.substr(7, 4);
            i.setData({
                "item.name": e.data.item[0].oss_buy_name,
                "item.phone": e.data.item[0].oss_buy_phone,
                price: e.data.go_real_price,
                time: e.data.date,
                code: e.data.go_code,
                info: e.data.item,
                data: e.data,
                newphone: o
            }), a.getTeamOpenid({
                openid: e.data.openid
            }).then(function(a) {
                i.setData({
                    member: a.data.user,
                    head: a.data.head_info
                });
            });
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    gotoGoods: function(a) {
        console.log(a);
        var e = a.currentTarget.dataset.gid, t = a.currentTarget.dataset.atid, o = a.currentTarget.dataset.time;
        wx.navigateTo({
            url: "/pages/goods/goodsDetail?id=" + e + "&at_id=" + t + "&actEndTime=" + o
        });
    },
    toHome: function(a) {
        wx.reLaunch({
            url: "/pages/template/index"
        });
    }
});